import 'package:Second/routerdemo/TabsLogin.dart';
import 'package:flutter/material.dart';

class RegisterNext extends StatefulWidget {
  RegisterNext({Key? key}) : super(key: key);

  @override
  _RegisterState createState() => _RegisterState();
}

class _RegisterState extends State<RegisterNext> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Register Page'),
      ),
      body: Column(
        children: [
          Text("注册第二步"),
          ElevatedButton(
              onPressed: () {
                //直接返回根路由，相当所有的压入路由栈的页面都出栈，然后压入你想显示的页面
                Navigator.of(context)
                    .pushNamedAndRemoveUntil('/', (route) => false);
                // Navigator.of(context).pushAndRemoveUntil(
                //     new MaterialPageRoute(
                //         builder: (context) => new TabsLogin(index: 0)),
                //     (route) => route == null);
              },
              child: Text('完成'))
        ],
      ),
    );
  }
}
